//
//  PreferencesView.h
//  MobileZIPCodes
//
//  Created by Andreas Schwelling on 02.12.07.
//	http://www.andi.de/zipcodes/
// 
//  Released under the GNU General Public License.
//  See LICENSE for details.
//
//  Use at your own risk.
//



#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <UIKit/UITransitionView.h>
#import <UIKit/UIPreferencesTable.h>
#import <UIKit/UISectionList.h>
#import <UIKit/UISegmentedControl.h>
#import <UIKit/UISwitchControl.h>
#import <UIKit/UIPreferencesTextTableCell.h>
#import <UIKit/UIButtonBar.h>
#import <UIKit/UIProgressIndicator.h>
#import <UIKit/UIProgressBar.h>
#import <WebCore/WebFontCache.h>

#import "DataManager.h"
#import "SearchView.h"
#import "Downloader.h"

@interface PreferencesTable: UIPreferencesTable {
	NSMutableArray		*_installedCountries,*_availableCountries;
}

- (void)setInstalledCountries:(NSMutableArray*)ic;
- (void)setAvailableCountries:(NSMutableArray*)ac;

@end

@interface PreferencesView : UIView {
	UINavigationBar			*_navBar;
	PreferencesTable		*_table;
	PreferencesView			*_self;
	NSMutableArray			*_removeCountries,*_downloadCountries;
	
	NSMutableArray			*_installedCountries,*_remoteAvailableCountries,*_localAvailableCountries;
	
	UIAlertSheet			*_downloadSuccessSheet,*_downloadSheet;
	UIProgressBar		*_progressIndicator;
	CGRect					_rect;
	id						_delegate;
	
	Downloader				*_downloader;
	NSString				*_actualDownload;
	int						_filedownloaded,_downloadsize,_downloaded,_totaldownloadsize;
	int						_newAvailableCountries;
	
	BOOL					_hasChanged;
	BOOL					_downloadFailed;
	
	DataManager				*_dm;
	
}


- (id)initWithFrame:(struct CGRect)rect;
-(void)dealloc;
- (BOOL) getHasChanged;
- (void) processChanges;
- (void) downloadFailed;
- (void) setUpgradeProgress:(int)byte;
- (void) downloadFinished;
- (void) dismissDownloadSheet:(id)p;
- (void) downloadNextFile:(id)p;
- (void) downloadAndDelete;
- (int) getnewAvailableCountries;
-(void)setDelegate:(id)del;
- (void) setDataManager:(DataManager*)dm;


@end
